<?php
/**
 * | ---------------------------------------------------------------------------------------------------
 * | Author：johnxu <fsyzxz@163.com>.
 * | ---------------------------------------------------------------------------------------------------
 * | Home: https://www.johnxu.net.
 * | ---------------------------------------------------------------------------------------------------
 * | Data: 2019-03-18
 * | ---------------------------------------------------------------------------------------------------
 * | Desc:
 * | ---------------------------------------------------------------------------------------------------
 */

namespace app\service\websocket\handler\drivers;

use app\service\websocket\handler\Driver;

/**
 * Ping Pong
 *
 * Class Ping
 *
 * @package app\service\websocket\handler\drivers
 */
class Ping extends Driver
{
    protected function getType()
    {
        return false;
    }

    protected function intercept( \swoole_websocket_server $server, $fd )
    {
        if ( $server->exist( $fd ) )
        {
            $server->push( $fd, 'PONG' );
        }

        return false;
    }
}